<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;

class NewHouse extends Model
{
	use HasDateTimeFormatter;
    protected $table = 'new_house';
    protected $dateFormat = 'U';

    public function setImagesAttribute($images)
    {
        if (is_array($images)){
            $this->attributes['images'] = implode("&",$images);
        }
    }

    public function building()
    {
        return $this->belongsTo('App\Models\Building','building_id');
    }

    public function houseType()
    {
        return $this->belongsTo('App\Models\FangAttrs','house_type_id');
    }

    public function forward()
    {
        return $this->belongsTo('App\Models\FangAttrs','forward');
    }

    public function fitUp()
    {
        return $this->belongsTo('App\Models\FangAttrs','fit_up');
    }
}
